package spring.jpa;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import spring.jpa.config.RootConfig;
import spring.jpa.config.ServletConfig;

public class MyWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        // spring 配置
        return new Class<?>[]{RootConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        // spring mvc 配置
        return new Class<?>[]{ServletConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        // DispatcherServlet 拦截路径，/* 拦截所有，/ 会排除 *.jsp 文件
        return new String[]{"/"};
    }
}